﻿Ext.define('Examples.autocomplex.firstleveldetail.metadata.Metadata', {
    extend: 'Happy.metadata.Metadata',
    singleton: true,
    requires: ['Examples.autocomplex.secondleveldetail.metadata.Metadata'],

    data: {
        namespace: 'Examples.autocomplex',
        name: 'FirstLevelDetail',
        plural: 'FirstLevelDetails',
        lifeCycle: 'dependent',
        properties: {
            Id: {
                name: 'Id',
                dataType: "Guid"
            },
            Name: {
                name: 'Name',
                dataType: "String"
            },
            RootId: {
                name: 'RootId',
                dataType: "Guid"
            }
        }
    },

    constructor: function () {
        var me = this;

        me.data.relation = {
            hasMany: [
                {
                    metadata: Examples.autocomplex.secondleveldetail.metadata.Metadata,
                    foreignKey: 'FirstLevelDetailId'
                }
            ]
        };

        me.callParent(arguments);
    }
});